package com.jsh.controller;


import com.jsh.entity.ShopUser;
import com.jsh.IShopUserService;
import com.jsh.uitls.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author jsh
 * @since 2022-11-15
 */
@RestController
@RequestMapping("/shop-user")
@Api(value = "用户信息接口", tags = "用户接口")
public class ShopUserController {

    @Autowired
    private IShopUserService iShopUserService;

    @ApiOperation("根据id查询用户")
    @PostMapping("/user/byid")
    public CommonResult selectById(@RequestParam  Integer id){

        ShopUser user = iShopUserService.getById(id);
        return CommonResult.ok(user);
    }

    @ApiOperation("添加用户")
    @PostMapping("/user/addUser")
    public CommonResult addUser(@RequestBody ShopUser shopUser){
        boolean save = this.iShopUserService.save(shopUser);

        return CommonResult.ok(save);

    }

}

